<% include ../header.ejs %>

<link rel="stylesheet" href="/stylesheets/app/evaluate/evaluate_servicelist.css">
<script src="/lib/moment/moment.js"></script>

<header data-am-widget="header" data-am-sticky class="am-header am-header-default am-header-fixed"
        id="appTemplates-Nav">


    <div class="am-header-left am-header-nav">
        <a href="javascript:history.go(-1)" onClick="">
            <img class="am-header-icon-custom"
                 src="data:image/svg+xml;charset=utf-8,&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 12 20&quot;&gt;&lt;path d=&quot;M10,0l2,2l-8,8l8,8l-2,2L0,10L10,0z&quot; fill=&quot;%23fff&quot;/&gt;&lt;/svg&gt;"
                 alt=""/>
            <span class="am-header-nav-title">
               服务评价
            </span>
        </a>
    </div>

    <h1 class="am-header-title">
        <a href="#title-link" class="" id="Typeface-whitecolor">服务列表</a>
    </h1>
</header>


<div data-am-widget="tabs" class="am-tabs am-tabs-d2">
    <ul class="am-tabs-nav am-cf">
        <li class="am-active">
            <a href="[data-tab-panel-0]" onclick="tabsClick('survey');">调研</a>
        </li>
        <li class="">
            <a href="[data-tab-panel-1]" onclick="tabsClick('roadshow');">路演</a>
        </li>
        <li class="">
            <a href="[data-tab-panel-2]" onclick="tabsClick('strategy');">策略会</a>
        </li>
        <li class="">
            <a href="[data-tab-panel-3]" onclick="tabsClick('recommond');">重点推荐</a>
        </li>
        <li class="">
            <a href="[data-tab-panel-4]" onclick="tabsClick('other');">其他</a>
        </li>
    </ul>
    <div class="am-tabs-bd">

        <% for(var panelcount = 0; panelcount < 5; panelcount++){ %>
            <% if(panelcount == 0){ %>
            <div data-tab-panel-<%= panelcount %>   class="am-tab-panel  am-active">
                <div data-am-widget="list_news" class="am-list-news am-list-news-default">
                    <div class="am-list-news-bd">
                        <ul class="am-list" id="custom-ul-<%= panelcount %>">
            <% }else{ %>
            <div data-tab-panel-<%= panelcount %>  class="am-tab-panel">
                <div data-am-widget="list_news" class="am-list-news am-list-news-default">
                    <div class="am-list-news-bd">
                        <ul class="am-list" id="custom-ul-<%= panelcount %>">
            <% } %>


                        </ul>
                    </div>

                    <!--<div class="am-list-news-ft">-->
                        <!--<a class="am-list-news-more am-btn am-btn-default " href="###">查看更多 &raquo;</a>-->
                    <!--</div>-->

                </div>
            </div>

        <% } %>

    </div>
</div>
<script>


    function tabsClick(stype){

        var options = {
            url: 'servicelistbytype',
            type: 'get',
            dataType: 'json',
            data: {'stype': stype,
                'seller':'<%=seller%>',
            },
            error: function (request) {
                alert("查询" + stype + "失败");
            },
            success: function (data) {

                switch (stype) {
                    case "survey":

                        var htmlText = "";

                        data.list.forEach(function(data, key) {

                            htmlText += "<li onclick=\"javascript:self.location='servicedetail?stype=survey&rowId=" + data.rowId  + "' \" class=\"am-g am-list-item-dated\">"
                            if (data.score != null && data.score != ""){
                                htmlText += "<a class=\"am-list-item-hd \"><span class=\"am-badge am-badge-warning\">" + data.score + "</span>" + data.industry.industryName + "</a>"
                            }else{
                                htmlText += "<a class=\"am-list-item-hd \"><span class=\"am-badge am-badge-success\">未打分</span>" + data.industry.industryName + "</a>"
                            }

                            if (data.content != null){
                                if (data.content.length > 60){
                                    htmlText += "<span class=\"am-list-item-text\">" + data.content.substring(0,60) + "...</span>"
                                }else{
                                    htmlText += "<span class=\"am-list-item-text\">" + data.content + "</span>"
                                }
                            }
                            //htmlText += "<span class=\"am-list-item-text \">行业类型:" + data.industry.industryName + "</span>"
                            //htmlText += "<span class=\"am-list-item-text\">参与人:" + data.contactName + "</span>"
                            htmlText += "<span class=\"am-list-item-text\">调研类型:<span class=\"am-badge am-badge-secondary\">"+ data.type +"</span></span>"
                            htmlText += "<span class=\"am-list-date\">"+ moment(data.startTime).format('YYYY-MM-DD') +"</span>"
                            htmlText += "</li>"

                        })
                        $('#custom-ul-0').html(htmlText);
                        break;

                    case "roadshow":
                        var htmlText = "";
                        data.list.forEach(function(data, key) {

                            htmlText += "<li onclick=\"javascript:self.location='servicedetail?stype=roadshow&rowId=" + data.rowId  + "' \" class=\"am-g am-list-item-dated\">"
                            if (data.score != null && data.score != ""){
                                htmlText += "<a class=\"am-list-item-hd \"><span class=\"am-badge am-badge-warning\">" + data.score + "</span>" + data.industry.industryName  + "</a>"
                            }else{
                                htmlText += "<a class=\"am-list-item-hd \"><span class=\"am-badge am-badge-success\">未打分</span>" + data.industry.industryName  + "</a>"
                            }

                            if (data.content != null){
                                if (data.content.length > 60){
                                    htmlText += "<span class=\"am-list-item-text\">" + data.content.substring(0,60) + "...</span>"
                                }else{
                                    htmlText += "<span class=\"am-list-item-text\">" + data.content + "</span>"
                                }
                            }
                            //htmlText += "<span class=\"am-list-item-text \">行业类型:" + data.industry.industryName + "</span>"
                            htmlText += "<span class=\"am-list-item-text\">路演类型:<span class=\"am-badge am-badge-secondary\">" + data.type + "</span></span>"
                            htmlText += "<span class=\"am-list-date\">"+ moment(data.startTime).format('YYYY-MM-DD') +"</span>"
                            htmlText += "</li>"

                        })
                        $('#custom-ul-1').html(htmlText);
                        break;

                    case "strategy":
                        var htmlText = "";
                        data.list.forEach(function(data, key) {

                            htmlText += "<li onclick=\"javascript:self.location='servicedetail?stype=strategy&rowId=" + data.rowId  + "' \" class=\"am-g am-list-item-dated\">"
                            if (data.score != null && data.score != ""){
                                htmlText += "<a class=\"am-list-item-hd \"><span class=\"am-badge am-badge-warning\">" + data.score + "</span>" + data.industry.industryName + "</a>"
                            }else{
                                htmlText += "<a class=\"am-list-item-hd \"><span class=\"am-badge am-badge-success\">未打分</span>" + data.industry.industryName + "</a>"
                            }

                            if (data.content != null){
                                if (data.content.length > 60){
                                    htmlText += "<span class=\"am-list-item-text\">" + data.content.substring(0,60) + "...</span>"
                                }else{
                                    htmlText += "<span class=\"am-list-item-text\">" + data.content + "</span>"
                                }
                            }
                            //htmlText += "<span class=\"am-list-item-text \">行业类型:" + data.industry.industryName + "</span>"
                            htmlText += "<span class=\"am-list-item-text\">策略会范围:" + data.range + "</span>"
                            htmlText += "<span class=\"am-list-date\">"+ moment(data.startTime).format('YYYY-MM-DD') +"</span>"
                            htmlText += "</li>"

                        })
                        $('#custom-ul-2').html(htmlText);
                        break;


                    case "recommond":
                        var htmlText = "";
                        data.list.forEach(function(data, key) {

                            htmlText += "<li onclick=\"javascript:self.location='servicedetail?stype=recommond&rowId=" + data.rowId  + "' \" class=\"am-g am-list-item-dated\">"
                            if (data.score != null && data.score != ""){
                                htmlText += "<a class=\"am-list-item-hd \"><span class=\"am-badge am-badge-warning\">" + data.score + "</span>股票代码:" + data.stockCode + "</a>"
                            }else{
                                htmlText += "<a class=\"am-list-item-hd \"><span class=\"am-badge am-badge-success\">未打分</span>股票代码:" + data.stockCode + "</a>"
                            }

                            if (data.content != null){
                                if (data.content.length > 60){
                                    htmlText += "<span class=\"am-list-item-text\">" + data.content.substring(0,60) + "...</span>"
                                }else{
                                    htmlText += "<span class=\"am-list-item-text\">" + data.content + "</span>"
                                }
                            }

                            htmlText += "<span class=\"am-list-item-text\">抛售时间:" + moment(data.sellingTime).format('YYYY-MM-DD HH:mm:ss') + "</span>"
                            htmlText += "<span class=\"am-list-item-text\">目标价:"+ data.targetPrice +"</span>"
                            htmlText += "<span class=\"am-list-date\">"+ moment(data.startTime).format('YYYY-MM-DD') +"</span>"
                            htmlText += "</li>"

                        })
                        $('#custom-ul-3').html(htmlText);
                        break;

                    case "other":
                        var htmlText = "";
                        data.list.forEach(function(data, key) {

                            htmlText += "<li onclick=\"javascript:self.location='servicedetail?stype=other&rowId=" + data.rowId  + "' \" class=\"am-g am-list-item-dated\">"
                            if (data.score != null && data.score != ""){
                                htmlText += "<a class=\"am-list-item-hd \"><span class=\"am-badge am-badge-warning\">" + data.score + "</span>" + data.title + "</a>"
                            }else{
                                htmlText += "<a class=\"am-list-item-hd \"><span class=\"am-badge am-badge-success\">未打分</span>股票代码" + data.title + "</a>"
                            }

                            if (data.content != null){
                                if (data.content.length > 60){
                                    htmlText += "<span class=\"am-list-item-text\">" + data.content.substring(0,60) + "...</span>"
                                }else{
                                    htmlText += "<span class=\"am-list-item-text\">" + data.content + "</span>"
                                }
                            }

                            htmlText += "<span class=\"am-list-item-text\">服务时间:" + moment(data.serviceTime).format('YYYY-MM-DD HH:mm:ss') + "</span>"
                            htmlText += "<span class=\"am-list-date\">"+ moment(data.startTime).format('YYYY-MM-DD') +"</span>"
                            htmlText += "</li>"

                        })
                        $('#custom-ul-4').html(htmlText);
                        break;

                    default:
                        console.log("tabsClick:wrong param");
                        res.redirect('/error');
                        return;

                }
            }
        };
        $.ajax(options);

    }

    window.onload = function () {
        tabsClick('survey');
    }

</script>

<% include ../footer.ejs %>